from langchain_community.chat_models import ChatZhipuAI
from langchain_core.prompts import ChatPromptTemplate
from langchain_core.output_parsers import StrOutputParser

model = ChatZhipuAI(
    model="glm-4-plus",
    temprature=0.5
)

prompts = ChatPromptTemplate.from_messages([
    ('system', '请将下列的语句用{language}翻译'),
    ('human', '{content}')
])

parser = StrOutputParser()

chains = prompts | model | parser

response = chains.invoke({"language": "Janpanese", "content": "中国的首都是北京"})
print(response)